<extend name="Public/base" />

<block name="style" >
    <link href="/am/styles/icon.css?v=20151127" rel="stylesheet" />
    <link href="/am/styles/sys_message.css?v=20151127" rel="stylesheet" />
    <style>
        .user_table{
            border: 1px solid #ddd;
            width: 180px;
        }
        .user_table tr{
            border: 1px solid #dddddd;
            height: 30px;
        }
        .user_table td{
            border: 1px solid #dddddd;
            width: 90px;
            text-align: center;
        }
        .current456{
            color: #FFF;
            background: #5FC03D;
        }
        #nav_des span{
            line-height: 35px;
            font-size:18px;
            padding: 4px 15px 4px 18px;
            cursor: pointer;
        }
        #nav_des span:hover{
         background: #81ce44;
     }
 </style>
</block>

<block name="body">
   <!-- 弹窗插件 -->
   <include file="Public:artdialog" />
   <!-- 表单验证插件 -->
   <include file="Public:validform" />
   <include file="Public:aomai_dialog_lay" />
   
   <div class="row">
    <div class="col-md-12">
        <div class="block-web">
            <div class="header">
               <div class="actions_diy">
               
            </div>
            <div id="nav_des">
                <span class="current456">基本信息</span>
                <span id="detail-tab">详细描述</span>
            </div>
        </div>
        <div class="porlets-content">
           <div id="content">
              <form action="{:U('doGroup')}" method="post" id="form_table" enctype="multipart/form-data">
               <input type="hidden" name="packageid" value="{$result['packageid']}">
               <input type="hidden" name="blongtype" value="{$blongtype}">
               <table class="con">
                   <tr>
                    <td class="" style="width:400px;">
                        <div class="form-group">
                            <label class="control-label"><font class="red">*</font>包名称</label>
                            <div class="" style="width:200px;">
                                <input type="text" value="{$result['packagename']}" name="packagename" placeholder="请输入包名称" class="form-control " datatype="*" nullmsg="包名称" readonly = "readonly" />
                                <div class="Validform_checktip"></div>
                            </div>
                        </div> 
                        <div class="form-group">
                            <label class="control-label"><font class="red"></font>开始时间</label>
                            <div class="" style="width:200px;">
                                <input type="text" name="starttime" readonly="readonly" id="start_time" placeholder="请输入开始时间" value="{$result['starttime']}" class="form-control laydate-icon"/>
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label"><font class="red"></font>结束时间</label>
                            <div class="" style="width:200px;">
                                <input type="text" name="endtime" readonly="readonly" id="end_time" placeholder="请输入结束时间" value="{$result['endtime']}" class="form-control laydate-icon"/>
                                <div class="Validform_checktip"></div>
                            </div>
                        </div>
                    </td>
                    <td class="" style="width:400px;">
                      <div class="form-group">
                        <label class="control-label"><font class="red"></font>零售总价格</label>
                        <div class="" style="width:200px;">
                            <input type="number" name="sprice"  value="{$result['sprice']|default='0.00'}" class="form-control" readonly = "readonly"/>
                            <div class="Validform_checktip"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label"><font class="red"></font>会员总价格</label>
                        <div class="" style="width:200px;">
                            <input type="number" name="uprice"  value="{$result['uprice']|default='0.00'}" class="form-control" readonly = "readonly"/>
                            <div class="Validform_checktip"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label"><font class="red"></font>VIP总价格</label>
                        <div class="" style="width:200px;">
                            <input type="number" name="vprice"  value="{$result['vprice']|default='0.00'}" class="form-control" readonly = "readonly"/>
                            <div class="Validform_checktip"></div>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="control-label"><font class="red">*</font>是否满员</label>
                        <div class="" style="width:200px;">
                         <empty name="result">
                          <label class="radio-inline">
                            <input type="radio"  name="isaccord" value="1" checked="checked" disabled = "disabled">
                            <span class="custom-radio"></span> 满员
                        </label>
                        <label class="radio-inline">
                            <input type="radio"    name="isaccord" value="0" disabled = "disabled">
                            <span class="custom-radio"></span> 不满员
                        </label>
                        <else/>
                        <if condition="$result['isaccord'] eq 0">
                            <label class="radio-inline">
                                <input type="radio"  name="isaccord" value="1" disabled = "disabled">
                                <span class="custom-radio"></span> 满员
                            </label>
                            <label class="radio-inline">
                                <input type="radio"    name="isaccord" value="0" checked="checked" disabled = "disabled">
                                <span class="custom-radio"></span> 不满员
                            </label>
                        </if>
                        <if condition="$result['isaccord'] eq 1">
                            <label class="radio-inline">
                                <input type="radio"  name="isaccord" value="1" checked="checked" disabled = "disabled">
                                <span class="custom-radio"></span> 满员
                            </label>
                            <label class="radio-inline">
                                <input type="radio"    name="isaccord" value="0" disabled = "disabled">
                                <span class="custom-radio"></span> 不满员
                            </label>
                        </if> 
                    </empty>
                </div>
            </div>
        </td>
        <td style="width:400px;"> 
          <div class="form-group">
            <label class="control-label"><font class="red"></font>最小购买数量</label>
            <div class="" style="width:200px;">
                <input type="number" name="minnumber"  value="{$result['minnumber']|default=1}" class="form-control" readonly = "readonly"/>
                <div class="Validform_checktip"></div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label"><font class="red"></font>最大购买数量</label>
            <div class="" style="width:200px;">
                <input type="number" name="maxnumber"  value="{$result['maxnumber']|default=1}" class="form-control" readonly = "readonly"/>
                <div class="Validform_checktip"></div>
            </div>
        </div>


        <?php if(isset($result['usertype'])):?>
          <if condition="$result['usertype'] eq 0">
              <div class="form-group">
                <label class="control-label"><font class="red"></font>违约金率</label>
                <div class="" style="width:200px;">
                    <input type="text" name="penalty"  value="{$result['penalty']}" class="form-control" readonly = "readonly"/>
                    <div class="Validform_checktip"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label"><font class="red"></font>提成率</label>
                <div class="" style="width:200px;">
                    <input type="text" name="commission"  value="{$result['commission']}" class="form-control" readonly = "readonly"/>
                    <div class="Validform_checktip"></div>
                </div>
            </div>
        </if>
    <?php endif;?>
</td>
<td>
   <div class="form-group">
    <label class="control-label"><font class="red">*</font>组团人数</label>
    <div class="" style="width:200px;">
        <input type="number" name="total"  placeholder="请输入组团人数" value="{$result['total']|default=1}" class="form-control" datatype="*" nullmsg="请输入组团人数" readonly = "readonly"/>
        <div class="Validform_checktip"></div>
    </div>
</div>
<div class="form-group">
    <label class="control-label"><font class="red"></font>组团总个数</label>
    <div class="" style="width:200px;">
        <input type="number" name="groupnumber"  value="{$result['groupnumber']|default=1}" class="form-control" readonly = "readonly"/>
        <div class="Validform_checktip"></div>
    </div>
</div> 
<div class="form-group">
    <label class="control-label"><font class="red"></font>包倍数</label>
    <div class="" style="width:200px;">
        <input type="number" name="multiple"  value="{$result['multiple']|default=10}" class="form-control" readonly = "readonly"/>
        <div class="Validform_checktip"></div>
    </div>
</div> 
<div class="form-group">
    <label class="control-label"><font class="red"></font>包总个数</label>
    <div class="" style="width:200px;">
        <input type="number" name="totalquantity" readonly="true"  value="{$result['totalquantity']}" class="form-control" readonly = "readonly"/>
        <div class="Validform_checktip"></div>
    </div>
</div> 
</td> 
</tr>
</table>
<table class="con" style="display:none">
  <tr>
      <td>
          {$FCKeditor}
      </td>
      <td>
         <volist name="img_list" id="img">
            <div id="gallery_{$img.img_id}" style="float:left; text-align:center; border: 1px solid #DADADA; margin: 4px; padding:2px;">
                <a href="javascript:;" onclick="if (confirm('{$lang.drop_img_confirm}')) dropImg('{$img.img_id}')">[-]</a><br />
                <a href="goods.php?act=show_image&img_url={$img.img_url}" target="_blank">
                    <img src="../{if $img.thumb_url}{$img.thumb_url}{else}{$img.img_url}{/if}" {if $thumb_width neq 0}width="{$thumb_width}"{/if} {if $thumb_height neq 0}height="{$thumb_height}"{/if} border="0" />
                </a>
            </div>
        </volist>
    </td>
    <td width="100px" style="padding-left:20px;">详情图片</td>
    <td style="display:;">

        <div class="upload_shop_img_item">
            <div class="upload_wrp">
                <div class="upload_preview" id="gallery_img">
                    <if condition="$imgs neq null" >
                        <volist name="imgs" id="img">
                            <div class="pics_wrp js_guige_images_unitymain" style="height: 247px;" id="file_{$img.id}">
                                <div class="edit_pic_wrp" style="width: 200px;max-width: 200px;height: 200px;">
                                    <img src="/Public/uploads/{$img.file_name}">
                                    <div class="edit_pic_mask">
                                        <a href="javascript:;" title="点击移除" target="_blank" class="icon18_common del_gray js_delete" onclick="removeThisImg(this,{$img.img_id});"></a>
                                        <a href="/Public/uploads/{$img.file_name}" title="查看原图" target="_blank" class="icon18_common search_gray js_delete"></a>
                                        <input type="hidden" name="gallery_img_pic[]" value="{$img.id}">

                                    </div>

                                </div>
                                <div class="gallery_img_sort">
                                    <label>排序：</label>
                                    <input type="text"  name="img_{$img.img_id}_sort" value="{$img.img_sort}" readonly = "readonly">
                                </div>
                                <input type="hidden" name="img_{$img.img_id}_id" value="{$img.img_id}" readonly = "readonly">
                            </div>
                        </volist>
                    </if>
                </div>
        </div>
    </div>

</td>
</tr>
</table>



</form>
</div>
</div>
<div id="load_tb_div" style="padding:10px 0px 30px ;">
  <div style="border-top:1px solid #dcdcdc;margin:5px 0px;">
    <h3 class="content-header">包商品列表</h3>
</div>
<table class="table table-striped goods_list_table   table-bordered table-condensed">
    <thead>
       <tr>

          <th class="opth140">商品名称</th>
          <th class="opth40">商品数量</th>
          <th class="opth40">零售价格</th>
          <th class="opth40">会员价格</th>
          <th class="opth40">VIP价格</th>
          <th class="opth40">操作员</th>
          <th class="opth40">修改时间</th>

      </tr>
  </thead>
  <tbody id="tbodylist">
     <volist name="results" id="lists">
         <tr field='"pgid":"{$lists.pgid}","goodsid":"{$lists.goodsid}","number":"{$lists.number}","saleprice":"{$lists.saleprice}","userprice":"{$lists.userprice}","vipprice":"{$lists.vipprice}","adminuserid":"{$lists.adminuserid}","addtime":"{$lists.addtime}"'>
            <td>{$lists['goods_name']}</td>
            <td><input type="text" num="{$lists['number']}" name="number" value="{$lists['number']|default='1'}" readonly = "readonly"/></td>
            <td><input type="text" saleprice="{$lists['saleprice']}" name="saleprice" value="{$lists['saleprice']}" readonly = "readonly"/></td>
            <td><input type="text" userprice="{$lists['userprice']}" name="userprice" value="{$lists['userprice']}" readonly = "readonly"/></td>
            <td><input type="text" vipprice="{$lists['vipprice']}" name="vipprice" value="{$lists['vipprice']}" readonly = "readonly"/></td>
            <td>{$lists['user_name']|default='-'}</td>
            <td>{$lists['addtime']|default='-'}</td>
        </tr>
    </volist>
	<empty name="results">
	 <tr> 
	 <td colspan="7">
	   暂无记录
	 </td>
	 </tr>
	 </empty>
</tbody>
</table>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">     </label>
    <input class="btn btn-primary" type="button" value="返回" onclick="back();"/>
</div>
</div><!--/porlets-content-->
</div><!--/block-web-->
</div>
</block>
<block name="script">
<script>
 var blongtype = "{$blongtype}";
       function back(){
         location.replace("{:U('groupList')}");
     }
     (function($){
        $.fn.tabs = function(options){
            var defaults = {
                currentStyle : "current",
                contentList  : "content_list"
            }
            options = $.extend(defaults,options);
            $(this).click(function(){
                $(this).addClass(options.currentStyle).siblings().removeClass(options.currentStyle);
                var _index = $(this).index();
                $("."+options.contentList).eq(_index).show().siblings().hide();
            })
        }
    var number = $("input[name ='total']").val();
    var minnumber = $("input[name ='minnumber']").val();
    var multiple = $("input[name ='multiple']").val();
    var maxnumber = $("input[name ='maxnumber']").val();
    var groupnumber = $("input[name ='groupnumber']").val();
    var totalquantity=  $("input[name ='totalquantity']").val();
    if(blongtype=="presell"){
        var maxnumber = $("input[name ='minnumber']").val();
    }else{
        if(maxnumber ==0 || maxnumber ==""){
           var maxnumber = $("input[name ='minnumber']").val();
       } 
   }
   var multiple = totalquantity/number/maxnumber/groupnumber;
   $("input[name ='multiple']").val(multiple);
    })(jQuery)    

    $("#nav_des span").tabs({
        currentStyle : "current456",
        contentList  : "con"
    });
</script>

</block>
